import{ requestA } from './request'
// 详细页的数据请求
function getDetail(iid) {
  return  requestA({
   url:'/detail',
   params:{
      iid
   }
  })
}
// 推荐商品的数据请求
function getRecommend() {
   return requestA({
     url:'/recommend'
   })
}

// 将详细页的商品信息, 物流信息, 以及价格优惠等其他封装成一个对象
class DetailGoods {
    constructor(itemInfo, columns, services) {
          this.title = itemInfo.title     // "高领黑白条纹长袖t恤女2018春秋新款韩版宽松百搭学生内搭打底衫"
          this.desc = itemInfo.desc       // "此款为2018春秋新款，面料选用类似莫代尔的一种面料~含棉滑布面~材质摸起来手感滑滑的~不起球不褪色！成本价出售，量够升价！喜欢的亲们赶紧下手吧！"
          this.newPrice = itemInfo.price  // "¥29.98"
          this.oldPrcie = itemInfo.oldPrcie
          this.discount = itemInfo.discountDesc  // "商家让利"
          this.columns = columns
          this.services = services
          this.realPrice = itemInfo.lowNowPrice  // "29.98"
    }
}

class Shop {
  constructor(shopInfo) {
     this.logo = shopInfo.shopLogo
     this.name = shopInfo.name
     this.fans = shopInfo.cFans
     this.sells = shopInfo.cSells
     this.score = shopInfo.score
     this.goodsCount = shopInfo.cGoods
  }
}

class GouWU {
  constructor(itemInfo, itemParams, shopInfo, iid) {
      this.topImag = itemInfo.topImages[0]
      this.title = itemInfo.title 
      this.jiage = itemInfo.lowNowPrice   // 最低价, 真实价格为大概数
      this.iid = iid
      this.name = shopInfo.name           // 商品店铺名字
  }
}


export {
    getDetail,
    DetailGoods,
    Shop,
    getRecommend,
    GouWU
}